home *** CD-ROM | disk | FTP | other *** search
/ Delphi 2 - Developers' Solutions / Delphi 2 Developers' Solutions.iso / dds / chap11 / howto01 / delphi10 / cciccinf.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1996-06-12  |  29.3 KB  |  814 lines

  1. unit Cciccinf;
  2.  
  3. interface
  4.  
  5. uses
  6.   SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  7.   Forms, Dialogs, StdCtrls, Buttons, ExtCtrls, Grids, Outline, CCWSock;
  8.  
  9. type
  10.   TCCICInfoDlg = class(TForm)
  11.     Panel1: TPanel;
  12.     BitBtn1: TBitBtn;
  13.     BitBtn2: TBitBtn;
  14.     Panel4: TPanel;
  15.     ListBox2: TListBox;
  16.     Panel2: TPanel;
  17.     Edit1: TEdit;
  18.     Panel3: TPanel;
  19.     Edit2: TEdit;
  20.     Panel5: TPanel;
  21.     Edit3: TEdit;
  22.     Panel8: TPanel;
  23.     Edit4: TEdit;
  24.     Panel9: TPanel;
  25.     Edit5: TEdit;
  26.     Panel6: TPanel;
  27.     Label1: TLabel;
  28.     Label2: TLabel;
  29.     Button1: TButton;
  30.     Button2: TButton;
  31.     Button3: TButton;
  32.     Button4: TButton;
  33.     ListBox1: TListBox;
  34.     procedure Button1Click(Sender: TObject);
  35.     procedure ListBox2Click(Sender: TObject);
  36.     procedure BitBtn1Click(Sender: TObject);
  37.     procedure BitBtn2Click(Sender: TObject);
  38.     procedure Edit4Exit(Sender: TObject);
  39.     procedure Button2Click(Sender: TObject);
  40.     procedure Button3Click(Sender: TObject);
  41.     procedure Button4Click(Sender: TObject);
  42.     procedure ListBox1DblClick(Sender: TObject);
  43.   private
  44.     { Private declarations }
  45.   public
  46.     { Public declarations }
  47.   end;
  48.  
  49. var
  50.   CCICInfoDlg: TCCICInfoDlg;
  51. const
  52.   LBClickVector : Integer = 0;
  53.   ActiveMailbox : Integer = 0;
  54.  
  55. implementation
  56.  
  57. uses CCICCFrm;
  58.  
  59. function inet_addr( IPAddressName : PChar ) :
  60.           Unsigned_Long_Integer; far; external 'WINSOCK';
  61. function gethostbyname( TheName : PChar ) :
  62.           PHost_Entry; far; external 'WINSOCK';
  63.  
  64. {$R *.DFM}
  65. procedure TCCICInfoDlg.Button1Click(Sender: TObject);
  66. var TempSocket : TCCSocket; { Used for IP Address info }
  67.     DataBuffer : array[ 0 .. 256 ] of char;
  68. begin
  69.   case Tag of
  70.     1 : begin  { Get IP Address Mode }
  71.           { Create the dummy socket }
  72.           TempSocket := TCCSocket.Create( Self );
  73.           TempSocket.Parent := Self;
  74.           { Use it to get the info }
  75.           with TempSocket do
  76.           begin
  77.             { Move the IP address into the data buffer }
  78.             StrPCopy( DataBuffer , Edit1.Text );
  79.             { Turn it into a real IP address in binary form }
  80.             Socket_IP_Address.Socket_Address.Full_Internet_Address :=
  81.              inet_addr( DataBuffer );
  82.             { If not found then do remote lookup }
  83.             if Socket_IP_Address.Socket_Address.Full_Internet_Address = INADDR_NONE then
  84.             begin
  85.               { Call blocking function on IP name }
  86.               Socket_Host_Entry := gethostbyname( DataBuffer );
  87.               { If still no good then error out and exit }
  88.               if Socket_Host_Entry = nil then
  89.               begin
  90.                 Edit2.Text := 'Could Not Convert Host Name';
  91.                 Edit3.Text := '';
  92.               end
  93.               else
  94.               begin
  95.                 { Otherwise get the address }
  96.                 Socket_IP_Address.Socket_Address :=
  97.                  Socket_Host_Entry^.Host_Address^^;
  98.                 Edit2.Text :=
  99.                  IntToStr( Socket_IP_Address.Socket_Address.Net_Byte ) + '.' +
  100.                  IntToStr( Socket_IP_Address.Socket_Address.Host_Byte ) + '.' +
  101.                  IntToStr( Socket_IP_Address.Socket_Address.Local_Host_Byte ) +
  102.                  '.' + IntToStr(
  103.                  Socket_IP_Address.Socket_Address.Local_Machine_Byte );
  104.                 Edit3.Text :=
  105.                  IntToStr( Socket_IP_Address.Socket_Address.
  106.                             Full_Internet_Address );
  107.               end;
  108.             end;
  109.           end;
  110.           { Free the dummy socket }
  111.           TempSocket.Free;
  112.         end;
  113.     2 : begin { Anonymous login punch }
  114.           Edit3.Text := 'anonymous';
  115.           CurrentRealPWString := CurrentPassWordString;
  116.           case PasswordControlVector of
  117.             1 : Edit4.Text := CurrentPassWordString;
  118.             2 : Edit4.Text := '**********';
  119.           end;
  120.         end;
  121.     5 : begin { Toggle subscribe/unsubscribe status }
  122.           if Edit3.Text = 'Subscribed' then Edit3.Text := 'UnSubscribed' else
  123.            Edit3.Text := 'Subscribed';
  124.         end;
  125.   end;
  126. end;
  127.  
  128. procedure TCCICInfoDlg.ListBox2Click(Sender: TObject);
  129. var TheWorkingList  : TList;
  130.     Counter_1       : Integer;
  131.     WorkingMBRecord : PEMailMailboxRecord;
  132.     Finished        : Boolean;
  133. begin
  134.   { Use Tag vector to find out how to interpret a click }
  135.   case Tag of
  136.     2 : begin
  137.           { If nothing in list box then exit }
  138.           if ListBox2.ItemIndex = -1 then exit;
  139.           { Use the data in the Working FTP Site List TList }
  140.           with PConnectionsRecord(
  141.            TheWorkingFTPSL.Items[ ListBox2.ItemIndex ] )^ do
  142.           begin
  143.               Edit1.Text := CProfile;
  144.               Edit2.Text := CIPAddress;
  145.               Edit3.Text := CUserName;
  146.               CurrentRealPWString := CPassword;
  147.               case PasswordControlVector of
  148.                 1 : Edit4.Text := CPassword;
  149.                 2 : Edit4.Text := '**********';
  150.               end;
  151.               Edit5.Text := CStartDir;
  152.           end;
  153.         end;
  154.     4 : begin
  155.           { If nothing in list box then exit }
  156.           if ListBox2.ItemIndex = -1 then exit;
  157.           { Use the data in the Working FTP Site List TList }
  158.           with PConnectionsRecord(
  159.            TheWorkingNSSL.Items[ ListBox2.ItemIndex ] )^ do
  160.           begin
  161.               Edit1.Text := CProfile;
  162.               Edit2.Text := CIPAddress;
  163.           end;
  164.         end;
  165.     5 : begin
  166.           { If nothing in list box then exit }
  167.           if ListBox2.ItemIndex = -1 then exit;
  168.           { Use the data in the Working FTP Site List TList }
  169.           with PNewsGroupRecord(
  170.            TheWorkingNRCSL.Items[ ListBox2.ItemIndex ] )^ do
  171.           begin
  172.               Edit1.Text := GName;
  173.               Edit2.Text := GRealName;
  174.               if GSubScribed then Edit3.Text := 'Subscribed' else
  175.                Edit3.Text := 'UnSubscribed';
  176.           end;
  177.         end;
  178.     6 : begin
  179.           { If nothing in list box then exit }
  180.           if ListBox2.ItemIndex = -1 then exit;
  181.           { Use the data in the Working POPSMTP Site List TList }
  182.           with PConnectionsRecord(
  183.            TheWorkingEMSL.Items[ ListBox2.ItemIndex ] )^ do
  184.           begin
  185.               Edit1.Text := CProfile;
  186.               Edit2.Text := CIPAddress;
  187.               Edit3.Text := CUserName;
  188.               CurrentEMRealPWString := CPassword;
  189.               case EMPasswordControlVector of
  190.                 1 : Edit4.Text := CPassword;
  191.                 2 : Edit4.Text := '**********';
  192.               end;
  193.               Edit5.Text := CStartDir;
  194.           end;
  195.         end;
  196.   end;
  197. end;
  198.  
  199. { This procedure saves the newly modified list of stuff to its base }
  200. procedure TCCICInfoDlg.BitBtn1Click(Sender: TObject);
  201. var Counter_1  : Integer;            { Loop counter        }
  202.     ThePointer : PConnectionsRecord; { Generic TCR Pointer }
  203.     TheNGRecord : PNewsGroupRecord;
  204.     TheMBRecord : PEMailMailboxRecord;
  205. begin
  206.   { Use the tag vector to find out what to do }
  207.   case Tag of
  208.     2 : begin { Do FTP Site List }
  209.           { dispose the old FTP site list's pointers }
  210.           for Counter_1 := 0 to TheFTPSiteList.Count - 1 do
  211.           begin
  212.             Dispose( PConnectionsRecord( TheFTPSiteList.Items[ Counter_1 ] ));
  213.           end;
  214.           { Clear the lists }
  215.           TheFTPSiteList.Clear;
  216.           CCInetCCForm.ComboBox1.Clear;
  217.           { Add the new info }
  218.           for Counter_1 := 0 to TheWorkingFTPSL.Count - 1 do
  219.           begin
  220.             { Create a new pointer }
  221.             New( ThePointer );
  222.             { Move the data into it }
  223.             ThePointer^ :=
  224.              PConnectionsRecord( TheWorkingFTPSL.Items[ Counter_1 ] )^;
  225.             { Add the item }
  226.             TheFTPSiteList.Add( ThePointer );
  227.             CCINetCCForm.ComboBox1.Items.Add( PConnectionsRecord(
  228.              TheFTPSiteList.Items[ Counter_1 ] )^.CProfile );
  229.           end;
  230.           CCINetCCForm.ComboBox1.ItemIndex := 0;
  231.         end;
  232.     4 : begin { Do NNTP Site List }
  233.           { dispose the old FTP site list's pointers }
  234.           for Counter_1 := 0 to TheNewsServerList.Count - 1 do
  235.           begin
  236.             Dispose( PConnectionsRecord( TheNewsServerList.Items[ Counter_1 ] ));
  237.           end;
  238.           { Clear the lists }
  239.           TheNewsServerList.Clear;
  240.           CCInetCCForm.ComboBox1.Clear;
  241.           { Add the new info }
  242.           for Counter_1 := 0 to TheWorkingNSSL.Count - 1 do
  243.           begin
  244.             { Create a new pointer }
  245.             New( ThePointer );
  246.             { Move the data into it }
  247.             ThePointer^ :=
  248.              PConnectionsRecord( TheWorkingNSSL.Items[ Counter_1 ] )^;
  249.             { Add the item }
  250.             TheNewsServerList.Add( ThePointer );
  251.             CCINetCCForm.ComboBox1.Items.Add( PConnectionsRecord(
  252.              TheNewsServerList.Items[ Counter_1 ] )^.CProfile );
  253.           end;
  254.           CCINetCCForm.ComboBox1.ItemIndex := 0;
  255.         end;
  256.     5 : begin { Do NNTP Newsgroups List }
  257.           { dispose the old NG list's pointers }
  258.           for Counter_1 := 0 to TheNewsRCList.Count - 1 do
  259.           begin
  260.             Dispose( PNewsGroupRecord( TheNewsRCList.Items[ Counter_1 ] ));
  261.           end;
  262.           { Clear the lists }
  263.           TheNewsRCList.Clear;
  264.           { Add the new info }
  265.           for Counter_1 := 0 to TheWorkingNRCSL.Count - 1 do
  266.           begin
  267.             { Create a new pointer }
  268.             New( TheNGRecord );
  269.             { Move the data into it }
  270.             TheNGRecord^ :=
  271.              PNewsGroupRecord( TheWorkingNRCSL.Items[ Counter_1 ] )^;
  272.             { Add the item }
  273.             TheNewsRCList.Add( TheNGRecord );
  274.           end;
  275.         end;
  276.     6 : begin { Do EMail Server List }
  277.           { dispose the old server list's pointers }
  278.           for Counter_1 := 0 to TheEMailServerList.Count - 1 do
  279.           begin
  280.             Dispose( PConnectionsRecord( TheEMailServerList.Items[ Counter_1 ] ));
  281.           end;
  282.           { Clear the lists }
  283.           TheEMailServerList.Clear;
  284.           CCInetCCForm.ComboBox1.Clear;
  285.           { Add the new info }
  286.           for Counter_1 := 0 to TheWorkingEMSL.Count - 1 do
  287.           begin
  288.             { Create a new pointer }
  289.             New( ThePointer );
  290.             { Move the data into it }
  291.             ThePointer^ :=
  292.              PConnectionsRecord( TheWorkingEMSL.Items[ Counter_1 ] )^;
  293.             { Add the item }
  294.             TheEMailServerList.Add( ThePointer );
  295.             CCINetCCForm.ComboBox1.Items.Add( PConnectionsRecord(
  296.              TheEMailServerList.Items[ Counter_1 ] )^.CProfile );
  297.           end;
  298.           CCINetCCForm.ComboBox1.ItemIndex := 0;
  299.         end;
  300.   end;
  301.   { Leave }
  302.   Close;
  303. end;
  304.  
  305. { This method cancels any changes made from entries in current setup & exits}
  306. procedure TCCICInfoDlg.BitBtn2Click(Sender: TObject);
  307. var Counter_1  : Integer;            { Loop counter        }
  308.     ThePointer : PConnectionsRecord; { Generic TCR Pointer }
  309.     TheNGRecord : PNewsGroupRecord;
  310.     TheEMMRecord : PEMailMailboxRecord;
  311. begin
  312.   { Use Tag vector do decide what to reset }
  313.   case Tag of
  314.     2 : begin { Reset FTP Site list }
  315.           { Dispose of all the old pointers }
  316.           for Counter_1 := 0 to TheWorkingFTPSL.Count - 1 do
  317.           begin
  318.             Dispose( PConnectionsRecord( TheWorkingFTPSL.Items[ Counter_1 ] ));
  319.           end;
  320.           { Clear the working list }
  321.           TheWorkingFTPSL.Clear;
  322.           { Clear the listbox }
  323.           ListBox2.Clear;
  324.           { Then rebuild the working list and display listbox }
  325.           for Counter_1 := 0 to TheFTPSiteList.Count - 1 do
  326.           begin
  327.             { Create the record }
  328.             New( ThePointer );
  329.             { Move data in }
  330.             ThePointer^ :=
  331.              PConnectionsRecord( TheFTPSiteList.Items[ Counter_1 ] )^;
  332.             { Add the pointer to the list }
  333.             TheWorkingFTPSL.Add( ThePointer );
  334.             { Add the profile name to the list }
  335.             ListBox2.Items.Add( PConnectionsRecord(
  336.              TheFTPSiteList.Items[ Counter_1 ] )^.CProfile );
  337.           end;
  338.         end;
  339.     4 : begin { Reset NNTP Site list }
  340.           { Dispose of all the old pointers }
  341.           for Counter_1 := 0 to TheWorkingNSSL.Count - 1 do
  342.           begin
  343.             Dispose( PConnectionsRecord( TheWorkingNSSL.Items[ Counter_1 ] ));
  344.           end;
  345.           { Clear the working list }
  346.           TheWorkingNSSL.Clear;
  347.           { Clear the listbox }
  348.           ListBox2.Clear;
  349.           { Then rebuild the working list and display listbox }
  350.           for Counter_1 := 0 to TheNewsServerList.Count - 1 do
  351.           begin
  352.             { Create the record }
  353.             New( ThePointer );
  354.             { Move data in }
  355.             ThePointer^ :=
  356.              PConnectionsRecord( TheNewsServerList.Items[ Counter_1 ] )^;
  357.             { Add the pointer to the list }
  358.             TheWorkingNSSL.Add( ThePointer );
  359.             { Add the profile name to the list }
  360.             ListBox2.Items.Add( PConnectionsRecord(
  361.              TheNewsServerList.Items[ Counter_1 ] )^.CProfile );
  362.           end;
  363.         end;
  364.     5 : begin { Reset NNTP NG list }
  365.           { Dispose of all the old pointers }
  366.           for Counter_1 := 0 to TheWorkingNRCSL.Count - 1 do
  367.           begin
  368.             Dispose( PNewsGroupRecord( TheWorkingNRCSL.Items[ Counter_1 ] ));
  369.           end;
  370.           { Clear the working list }
  371.           TheWorkingNRCSL.Clear;
  372.           { Clear the listbox }
  373.           ListBox2.Clear;
  374.           { Then rebuild the working list and display listbox }
  375.           for Counter_1 := 0 to TheNewsRCList.Count - 1 do
  376.           begin
  377.             { Create the record }
  378.             New( TheNGRecord );
  379.             { Move data in }
  380.             TheNGRecord^ :=
  381.              PNewsGroupRecord( TheNewsRCList.Items[ Counter_1 ] )^;
  382.             { Add the pointer to the list }
  383.             TheWorkingNRCSL.Add( TheNGRecord );
  384.             { Add the profile name to the list }
  385.             ListBox2.Items.Add( PNewsGroupRecord(
  386.              TheNewsRCList.Items[ Counter_1 ] )^.GName );
  387.           end;
  388.         end;
  389.     6 : begin { Reset FTP Site list }
  390.           { Dispose of all the old pointers }
  391.           for Counter_1 := 0 to TheWorkingEMSL.Count - 1 do
  392.           begin
  393.             Dispose( PConnectionsRecord( TheWorkingEMSL.Items[ Counter_1 ] ));
  394.           end;
  395.           { Clear the working list }
  396.           TheWorkingEMSL.Clear;
  397.           { Clear the listbox }
  398.           ListBox2.Clear;
  399.           { Then rebuild the working list and display listbox }
  400.           for Counter_1 := 0 to TheEMailServerList.Count - 1 do
  401.           begin
  402.             { Create the record }
  403.             New( ThePointer );
  404.             { Move data in }
  405.             ThePointer^ :=
  406.              PConnectionsRecord( TheEMailServerList.Items[ Counter_1 ] )^;
  407.             { Add the pointer to the list }
  408.             TheWorkingEMSL.Add( ThePointer );
  409.             { Add the profile name to the list }
  410.             ListBox2.Items.Add( PConnectionsRecord(
  411.              TheEMailServerList.Items[ Counter_1 ] )^.CProfile );
  412.           end;
  413.         end;
  414.   end;
  415.   { Leave }
  416.   Close;
  417. end;
  418.  
  419. procedure TCCICInfoDlg.Edit4Exit(Sender: TObject);
  420. begin
  421.   { Use tag vector to determine action }
  422.   case Tag of
  423.     2 : begin
  424.           { If Edit4 is modified then mangle pw }
  425.           if Edit4.Modified then
  426.           begin
  427.             { Save pw in either case, but mangle if masked }
  428.             case PasswordControlVector of
  429.               1 : CurrentRealPWString := Edit4.Text;
  430.               2 : begin
  431.                     CurrentRealPWString := Edit4.Text;
  432.                     Edit4.Text := '***********';
  433.                   end;
  434.             end;
  435.           end;
  436.         end;
  437.     6 : begin
  438.           { If Edit4 is modified then mangle pw }
  439.           if Edit4.Modified then
  440.           begin
  441.             { Save pw in either case, but mangle if masked }
  442.             case EMPasswordControlVector of
  443.               1 : CurrentEMRealPWString := Edit4.Text;
  444.               2 : begin
  445.                     CurrentEMRealPWString := Edit4.Text;
  446.                     Edit4.Text := '***********';
  447.                   end;
  448.             end;
  449.           end;
  450.         end;
  451.   end;
  452. end;
  453.  
  454. { Add button; do various add actions }
  455. procedure TCCICInfoDlg.Button2Click(Sender: TObject);
  456. var ThePointer  : PConnectionsRecord; { PCR Pointer }
  457.     TheNGRecord : PNewsGroupRecord;
  458.     TheEMBRecord : PEMailMailboxRecord;
  459.     TempList    : TList;
  460. begin
  461.   { Tag vector control as usual }
  462.   case Tag of
  463.     2 : begin { add new FTP site list entry }
  464.           { Creat new PCR pointer }
  465.           New( ThePointer );
  466.           { Add in the data from the text fields }
  467.           with ThePointer^ do
  468.           begin
  469.             CProfile   := Edit1.Text;
  470.             CIPAddress := Edit2.Text;;
  471.             CUserName  := Edit3.Text;
  472.             { Put in the real pw string }
  473.             CPassword  := CurrentRealPWString;
  474.             CStartDir  := Edit5.Text;
  475.           end;
  476.           { Add pointer to working list }
  477.           TheWorkingFTPSL.Add( ThePointer );
  478.           { Add it to the listbox }
  479.           ListBox2.Items.Add( ThePointer^.CProfile );
  480.           { And set the pointer to it }
  481.           ListBox2.ItemIndex := ListBox2.Items.Count - 1;
  482.         end;
  483.     4 : begin { add new NNTP site list entry }
  484.           { Creat new PCR pointer }
  485.           New( ThePointer );
  486.           { Add in the data from the text fields }
  487.           with ThePointer^ do
  488.           begin
  489.             CProfile   := Edit1.Text;
  490.             CIPAddress := Edit2.Text;;
  491.             CUserName  := '';
  492.             CPassword  := '';
  493.             CStartDir  := '';
  494.           end;
  495.           { Add pointer to working list }
  496.           TheWorkingNSSL.Add( ThePointer );
  497.           { Add it to the listbox }
  498.           ListBox2.Items.Add( ThePointer^.CProfile );
  499.           { And set the pointer to it }
  500.           ListBox2.ItemIndex := ListBox2.Items.Count - 1;
  501.         end;
  502.     5 : begin { add new NNTP newsgroup list entry }
  503.           { Creat new PCR pointer }
  504.           New( TheNGRecord );
  505.           TempList := TList.Create;
  506.           { Add in the data from the text fields }
  507.           with TheNGRecord^ do
  508.           begin
  509.             GName     := Edit1.Text;
  510.             GRealName := Edit2.Text;;
  511.             if Edit3.Text = 'UnSubscribed' then GSubscribed := false else
  512.              GSubScribed := true;
  513.             GLowest              := 0;
  514.             GHighest             := 0;
  515.             GTotalNew            := 0;
  516.             GTotalAvailable      := 0;
  517.             GLowestAvailable     := 0;
  518.             GHighestAvailable    := 0;
  519.             GPostable            := true;
  520.             GTotalArticles       := 0;
  521.             GTotalUnReadArticles := 0;
  522.             GIDNumber            := TheWorkingNRCSL.Count + 1;
  523.             GFileName            := 'NL' + IntToStr( WhichServer ) + 'G' +
  524.                                     IntToStr( GIDNumber) + '.NGR';
  525.             GLTag                := Longint( TempList );
  526.           end;
  527.           { Add pointer to working list }
  528.           TheWorkingNRCSL.Add( TheNGRecord );
  529.           { Add it to the listbox }
  530.           ListBox2.Items.Add( TheNGRecord^.GName );
  531.           { And set the pointer to it }
  532.           ListBox2.ItemIndex := ListBox2.Items.Count - 1;
  533.         end;
  534.     6 : begin { add new EMail server list entry }
  535.           { Creat new PCR pointer }
  536.           New( ThePointer );
  537.           { Add in the data from the text fields }
  538.           with ThePointer^ do
  539.           begin
  540.             CProfile   := Edit1.Text;
  541.             CIPAddress := Edit2.Text;;
  542.             CUserName  := Edit3.Text;
  543.             { Put in the real pw string }
  544.             CPassword  := CurrentEMRealPWString;
  545.             CStartDir  := Edit5.Text;
  546.           end;
  547.           { Add pointer to working list }
  548.           TheWorkingEMSL.Add( ThePointer );
  549.           { Add it to the listbox }
  550.           ListBox2.Items.Add( ThePointer^.CProfile );
  551.           { And set the pointer to it }
  552.           ListBox2.ItemIndex := ListBox2.Items.Count - 1;
  553.         end;
  554.   end;
  555. end;
  556.  
  557. { This is the modify button }
  558. procedure TCCICInfoDlg.Button3Click(Sender: TObject);
  559. begin
  560.   { Use Tag vector as usual }
  561.   case Tag of
  562.     2 : begin
  563.           { if nothing to modify the exit }
  564.           if ListBox2.ItemIndex = -1 then exit;
  565.           { get record of current listbox pointer & put in data }
  566.           with PConnectionsRecord(
  567.            TheWorkingFTPSL.Items[ ListBox2.ItemIndex ] )^ do
  568.           begin
  569.             CProfile   := Edit1.Text;
  570.             CIPAddress := Edit2.Text;;
  571.             CUserName  := Edit3.Text;
  572.             { Put in the real pw string }
  573.             CPassword  := CurrentRealPWString;
  574.             CStartDir  := Edit5.Text;
  575.           end;
  576.           { Make sure the display matches the edit control }
  577.           ListBox2.Items[ ListBox2.ItemIndex ] := Edit1.Text;
  578.         end;
  579.     4 : begin
  580.           { if nothing to modify the exit }
  581.           if ListBox2.ItemIndex = -1 then exit;
  582.           { get record of current listbox pointer & put in data }
  583.           with PConnectionsRecord(
  584.            TheWorkingNSSL.Items[ ListBox2.ItemIndex ] )^ do
  585.           begin
  586.             CProfile   := Edit1.Text;
  587.             CIPAddress := Edit2.Text;
  588.             CUserName  := '';
  589.             CPassword  := '';
  590.             CStartDir  := '';
  591.           end;
  592.           { Make sure the display matches the edit control }
  593.           ListBox2.Items[ ListBox2.ItemIndex ] := Edit1.Text;
  594.         end;
  595.     5 : begin
  596.           { if nothing to modify the exit }
  597.           if ListBox2.ItemIndex = -1 then exit;
  598.           { get record of current listbox pointer & put in data }
  599.           with PNewsGroupRecord(
  600.            TheWorkingNRCSL.Items[ ListBox2.ItemIndex ] )^ do
  601.           begin
  602.             GName     := Edit1.Text;
  603.             GRealName := Edit2.Text;;
  604.             if Edit3.Text = 'UnSubscribed' then GSubscribed := false else
  605.              GSubScribed := true;
  606.           end;
  607.           { Make sure the display matches the edit control }
  608.           ListBox2.Items[ ListBox2.ItemIndex ] := Edit1.Text;
  609.         end;
  610.     6 : begin
  611.           { if nothing to modify the exit }
  612.           if ListBox2.ItemIndex = -1 then exit;
  613.           { get record of current listbox pointer & put in data }
  614.           with PConnectionsRecord(
  615.            TheWorkingEMSL.Items[ ListBox2.ItemIndex ] )^ do
  616.           begin
  617.             CProfile   := Edit1.Text;
  618.             CIPAddress := Edit2.Text;;
  619.             CUserName  := Edit3.Text;
  620.             { Put in the real pw string }
  621.             CPassword  := CurrentEMRealPWString;
  622.             CStartDir  := Edit5.Text;
  623.           end;
  624.           { Make sure the display matches the edit control }
  625.           ListBox2.Items[ ListBox2.ItemIndex ] := Edit1.Text;
  626.         end;
  627.   end;
  628. end;
  629.  
  630. { This is the delete button }
  631. procedure TCCICInfoDlg.Button4Click(Sender: TObject);
  632. var MessageString : String; { String holder }
  633. begin
  634.   { Use tag control vector }
  635.   case Tag of
  636.     2 : begin
  637.           { If nothing to delete then leave }
  638.           if Listbox2.Itemindex = -1 then exit;
  639.           { Set up display }
  640.           MessageString := 'Delete Entry ' + Edit1.Text + '?';
  641.           { Display message box and get result }
  642.           if MessageDlg( MessageString , mtConfirmation , mbYesNoCancel , 0 )
  643.            = mrYes then
  644.           begin
  645.             { if ok delete then remove item from working sl }
  646.             TheWorkingFTPSL.Delete( ListBox2.ItemIndex );
  647.             { delete from listbox }
  648.             ListBox2.Items.Delete( ListBox2.ItemIndex );
  649.             { If nothing left set itemindex and clear edits }
  650.             if ListBox2.Items.Count = 0 then
  651.             begin
  652.               ListBox2.ItemIndex := -1;
  653.               Edit1.Text := '';
  654.               Edit2.Text := '';
  655.               Edit3.Text := '';
  656.               Edit4.Text := '';
  657.               Edit5.Text := '';
  658.             end
  659.             else
  660.             begin
  661.               { Reset listbox pointer }
  662.               ListBox2.ItemIndex  := 0;
  663.               { and reset display to new item }
  664.               with PConnectionsRecord(
  665.                TheWorkingFTPSL.Items[ ListBox2.ItemIndex ] )^ do
  666.               begin
  667.                 Edit1.Text := CProfile;
  668.                 Edit2.Text := CIPAddress;
  669.                 Edit3.Text := CUserName;
  670.                 CurrentRealPWString := CPassword;
  671.                 case PasswordControlVector of
  672.                   1 : Edit4.Text := CPassword;
  673.                   2 : Edit4.Text := '**********';
  674.                 end;
  675.                 Edit5.Text := CStartDir;
  676.               end;
  677.             end;
  678.           end;
  679.         end;
  680.     4 : begin
  681.           { If nothing to delete then leave }
  682.           if Listbox2.Itemindex = -1 then exit;
  683.           { Set up display }
  684.           MessageString := 'Delete Entry ' + Edit1.Text + '?';
  685.           { Display message box and get result }
  686.           if MessageDlg( MessageString , mtConfirmation , mbYesNoCancel , 0 )
  687.            = mrYes then
  688.           begin
  689.             { if ok delete then remove item from working sl }
  690.             TheWorkingNSSL.Delete( ListBox2.ItemIndex );
  691.             { delete from listbox }
  692.             ListBox2.Items.Delete( ListBox2.ItemIndex );
  693.             { If nothing left set itemindex and clear edits }
  694.             if ListBox2.Items.Count = 0 then
  695.             begin
  696.               ListBox2.ItemIndex := -1;
  697.               Edit1.Text := '';
  698.               Edit2.Text := '';
  699.               Edit3.Text := '';
  700.               Edit4.Text := '';
  701.               Edit5.Text := '';
  702.             end
  703.             else
  704.             begin
  705.               { Reset listbox pointer }
  706.               ListBox2.ItemIndex  := 0;
  707.               { and reset display to new item }
  708.               with PConnectionsRecord(
  709.                TheWorkingNSSL.Items[ ListBox2.ItemIndex ] )^ do
  710.               begin
  711.                 Edit1.Text := CProfile;
  712.                 Edit2.Text := CIPAddress;
  713.               end;
  714.             end;
  715.           end;
  716.         end;
  717.     5 : begin
  718.           { If nothing to delete then leave }
  719.           if Listbox2.Itemindex = -1 then exit;
  720.           { Set up display }
  721.           MessageString := 'Delete Entry ' + Edit1.Text + '?';
  722.           { Display message box and get result }
  723.           if MessageDlg( MessageString , mtConfirmation , mbYesNoCancel , 0 )
  724.            = mrYes then
  725.           begin
  726.             { if ok delete then remove item from working sl }
  727.             TheWorkingNRCSL.Delete( ListBox2.ItemIndex );
  728.             { delete from listbox }
  729.             ListBox2.Items.Delete( ListBox2.ItemIndex );
  730.             { If nothing left set itemindex and clear edits }
  731.             if ListBox2.Items.Count = 0 then
  732.             begin
  733.               ListBox2.ItemIndex := -1;
  734.               Edit1.Text := '';
  735.               Edit2.Text := '';
  736.               Edit3.Text := '';
  737.               Edit4.Text := '';
  738.               Edit5.Text := '';
  739.             end
  740.             else
  741.             begin
  742.               { Reset listbox pointer }
  743.               ListBox2.ItemIndex  := 0;
  744.               { and reset display to new item }
  745.               with PNewsGroupRecord(
  746.                TheWorkingNRCSL.Items[ ListBox2.ItemIndex ] )^ do
  747.               begin
  748.                 Edit1.Text := GName;
  749.                 Edit2.Text := GRealName;
  750.                 if not GSubscribed then Edit3.Text := 'UnSubscribed' else
  751.                  Edit3.Text := 'SubScribed';
  752.               end;
  753.             end;
  754.           end;
  755.         end;
  756.     6 : begin
  757.           { If nothing to delete then leave }
  758.           if Listbox2.Itemindex = -1 then exit;
  759.           { Set up display }
  760.           MessageString := 'Delete Entry ' + Edit1.Text + '?';
  761.           { Display message box and get result }
  762.           if MessageDlg( MessageString , mtConfirmation , mbYesNoCancel , 0 )
  763.            = mrYes then
  764.           begin
  765.             { if ok delete then remove item from working sl }
  766.             TheWorkingEMSL.Delete( ListBox2.ItemIndex );
  767.             { delete from listbox }
  768.             ListBox2.Items.Delete( ListBox2.ItemIndex );
  769.             { If nothing left set itemindex and clear edits }
  770.             if ListBox2.Items.Count = 0 then
  771.             begin
  772.               ListBox2.ItemIndex := -1;
  773.               Edit1.Text := '';
  774.               Edit2.Text := '';
  775.               Edit3.Text := '';
  776.               Edit4.Text := '';
  777.               Edit5.Text := '';
  778.             end
  779.             else
  780.             begin
  781.               { Reset listbox pointer }
  782.               ListBox2.ItemIndex  := 0;
  783.               { and reset display to new item }
  784.               with PConnectionsRecord(
  785.                TheWorkingEMSL.Items[ ListBox2.ItemIndex ] )^ do
  786.               begin
  787.                 Edit1.Text := CProfile;
  788.                 Edit2.Text := CIPAddress;
  789.                 Edit3.Text := CUserName;
  790.                 CurrentEMRealPWString := CPassword;
  791.                 case EMPasswordControlVector of
  792.                   1 : Edit4.Text := CPassword;
  793.                   2 : Edit4.Text := '**********';
  794.                 end;
  795.                 Edit5.Text := CStartDir;
  796.               end;
  797.             end;
  798.           end;
  799.         end;
  800.   end;
  801. end;
  802.  
  803. procedure TCCICInfoDlg.ListBox1DblClick(Sender: TObject);
  804. begin
  805.   case Tag of
  806.     5 : begin
  807.           if ListBox1.ItemIndex <> -1 then
  808.            Edit2.Text := ListBox1.Items[ Listbox1.ItemIndex ];
  809.         end;
  810.   end;
  811. end;
  812.  
  813. end.
  814.